package sina.girl;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.apache.http.client.ClientProtocolException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class Test {
    
    public static Map<String, String> getPicInfo(String url) throws ClientProtocolException, IOException {
        Map<String, String> map = new HashMap<String, String>();
        
        String html = ReadFile.getFileContent("d:/1.html", "gbk");
        Document doc = Jsoup.parse(html, "utf-8");
        Elements picPathElements = doc.getElementsByTag("dl");// 查询图片路径
        
        if (null != picPathElements && picPathElements.size() > 0) {
            for (Element element : picPathElements) {
                String strs[] = element.text().split(" ");
                map.put("pacname", strs[0]);
                map.put("picpath", strs[1]);
            }
        }
        return map;
    }
    
    public static void main(String[] args) {
        try {
            System.out.println(getPicInfo(""));
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}